package com.demo.controller;

import com.demo.service.RestaurantsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


@Controller
@Scope(value="prototype")
@RequestMapping(value="/")
@EnableAutoConfiguration
public class HelloController {
	private Logger logger = LoggerFactory.getLogger(HelloController.class);
	
	public HelloController(){
		logger.debug("========HelloController======");
	}
	
	@Autowired
	private RestaurantsService restaurantsService;
	
	@RequestMapping(value="/")
	public ModelAndView index() {
		ModelAndView mv = new ModelAndView();
		logger.debug("======index========");
		
		mv.setViewName("upload");
		return mv;
	}
	/**
	 * handle /hello request
	 * 
	 * @return
	 */
	@RequestMapping(value = "/hello")
	public ModelAndView sayHello() {
		logger.debug("request:/hello -- start");
		ModelAndView mv = new ModelAndView();
		mv.addObject("message", "Hello Reader! ");
		mv.setViewName("index");
		logger.debug("request:/hello -- end");
		return mv;
	}

}
